package com.deuwise.system.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.deuwise.system.entity.LayerTypeDo;
import com.deuwise.system.mapper.LayerTypeDoMapper;
import com.deuwise.system.service.LayerTypeDoService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

/**
 * Copyright
 *
 * @author chenwenchao
 * @date 2019/12/31
 * Description:
 */
@Service
public class LayerTypeDoServiceImpl extends ServiceImpl<LayerTypeDoMapper, LayerTypeDo> implements LayerTypeDoService {

    @Override
    public int queryByName(String name, LayerTypeDo layerTypeDo) {
        Wrapper<LayerTypeDo> dictDoEntityWrapper=new EntityWrapper<>();
        dictDoEntityWrapper.eq("name",name);
        if(layerTypeDo!=null){
            if(StringUtils.isNotBlank(layerTypeDo.getId())) {
                dictDoEntityWrapper.ne("id", layerTypeDo.getId());
            }
        }
        return baseMapper.selectCount(dictDoEntityWrapper);
    }
}
